﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.plaf.basic.background {
    import flash.display.*;
    import org.aswing.*;
    import org.aswing.geom.*;
    import org.aswing.plaf.*;
    import org.aswing.graphics.*;
    import org.aswing.plaf.basic.*;

    public class ProgressBarIcon implements GroundDecorator, UIResource {

        protected var shape:Shape;
        protected var indeterminatePercent:Number;

        public function ProgressBarIcon(){
            this.shape = new Shape();
            this.indeterminatePercent = 0;
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            return (this.shape);
        }
        public function updateDecorator(_arg1:Component, _arg2:Graphics2D, _arg3:IntRectangle):void{
            var _local4:JProgressBar;
            var _local5:Number;
            var _local6:Boolean;
            var _local7:StyleTune;
            var _local8:Number;
            var _local9:Number;
            var _local10:StyleResult;
            if ((_arg1 is JProgressBar)){
                _local4 = JProgressBar(_arg1);
                _arg3 = _arg3.clone();
                if (_local4.isIndeterminate()){
                    _local5 = this.indeterminatePercent;
                    this.indeterminatePercent = (this.indeterminatePercent + 0.1);
                    if (this.indeterminatePercent > 1){
                        this.indeterminatePercent = 0;
                    };
                } else {
                    _local5 = _local4.getPercentComplete();
                };
                _local6 = (_local4.getOrientation() == AsWingConstants.VERTICAL);
                this.shape.graphics.clear();
                _local7 = _arg1.getStyleTune().mide;
                _arg2 = new Graphics2D(this.shape.graphics);
                _local8 = 0;
                if (_local6){
                    _local8 = Math.floor((_arg3.width / 2));
                    _local9 = 0;
                    _arg3.height = (_arg3.height * _local5);
                } else {
                    _local8 = Math.floor((_arg3.height / 2));
                    _local9 = (Math.PI / 2);
                    _arg3.width = (_arg3.width * _local5);
                };
                if (_local8 > _local7.round){
                    _local8 = _local7.round;
                };
                if (_arg3.width > 1){
                    _local10 = new StyleResult(_arg1.getMideground(), _local7);
                    BasicGraphicsUtils.fillGradientRoundRect(_arg2, _arg3, _local10, _local9);
                    BasicGraphicsUtils.drawGradientRoundRectLine(_arg2, _arg3, 1, _local10, _local9);
                    if ((_arg3.width - (_local8 * 2)) > 0){
                        _arg2.fillRectangle(new SolidBrush(_arg1.getMideground().changeAlpha(0.3)), _local8, (_arg3.height - 2.5), (_arg3.width - (_local8 * 2)), 1.5);
                    };
                };
            };
        }

    }
}//package org.aswing.plaf.basic.background 
